package com.newasia.server.controller;

import com.newasia.server.common.exception.BaseBusinessException;
import com.newasia.server.controller.form.LoginForm;
import com.newasia.server.common.result.ResponseData;
import com.newasia.server.common.result.ResponseUtil;
import com.newasia.server.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author LiChong
 * @description 仅用于登录
 * @date 2020/4/2
 */

@RestController
public class LoginController {

    @Autowired
    IUserService userService;

    @PostMapping("/login")
    public ResponseData login(@RequestBody LoginForm form){
        ResponseData data = userService.login(form);
        return new ResponseUtil().setData(data);
    }
}
